package com.hiultra.archive.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hiultra.common.annotation.Log;
import com.hiultra.common.core.controller.BaseController;
import com.hiultra.common.core.domain.AjaxResult;
import com.hiultra.common.enums.BusinessType;
import com.hiultra.archive.domain.ArchiveBoxStatus;
import com.hiultra.archive.service.IArchiveBoxStatusService;
import com.hiultra.common.utils.poi.ExcelUtil;
import com.hiultra.common.core.page.TableDataInfo;

/**
 * 档案盒状态记录Controller
 * 
 * @author 派大星
 * @date 2024-07-23
 */
@RestController
@RequestMapping("/archive/ArchiveBoxStatus")
public class ArchiveBoxStatusController extends BaseController
{
    @Autowired
    private IArchiveBoxStatusService archiveBoxStatusService;

    /**
     * 查询盒状态记录列表
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveBoxStatus:list')")
    @GetMapping("/list")
    public TableDataInfo list(ArchiveBoxStatus archiveBoxStatus)
    {
        startPage();
        List<ArchiveBoxStatus> list = archiveBoxStatusService.selectArchiveBoxStatusList(archiveBoxStatus);
        return getDataTable(list);
    }

    /**
     * 导出盒状态记录列表
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveBoxStatus:export')")
    @Log(title = "盒状态记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ArchiveBoxStatus archiveBoxStatus)
    {
        List<ArchiveBoxStatus> list = archiveBoxStatusService.selectArchiveBoxStatusList(archiveBoxStatus);
        ExcelUtil<ArchiveBoxStatus> util = new ExcelUtil<ArchiveBoxStatus>(ArchiveBoxStatus.class);
        util.exportExcel(response, list, "盒状态记录数据");
    }

    /**
     * 获取盒状态记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveBoxStatus:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(archiveBoxStatusService.selectArchiveBoxStatusById(id));
    }

    /**
     * 新增盒状态记录
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveBoxStatus:add')")
    @Log(title = "盒状态记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ArchiveBoxStatus archiveBoxStatus)
    {
        return toAjax(archiveBoxStatusService.insertArchiveBoxStatus(archiveBoxStatus));
    }

    /**
     * 修改盒状态记录
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveBoxStatus:edit')")
    @Log(title = "盒状态记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ArchiveBoxStatus archiveBoxStatus)
    {
        return toAjax(archiveBoxStatusService.updateArchiveBoxStatus(archiveBoxStatus));
    }

    /**
     * 删除盒状态记录
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveBoxStatus:remove')")
    @Log(title = "盒状态记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(archiveBoxStatusService.deleteArchiveBoxStatusByIds(ids));
    }
}
